home *** CD-ROM | disk | FTP | other *** search
- //load all the table defs
- function NOF_DataObjects_Ecomm(){
- this.__proto__ = NOF_DataObjects_Ecomm;
- this.StoresTable = (new NOF_DataObjects_StoresTable()).getTable();
- this.CatalogsTable = (new NOF_DataObjects_CatalogsTable()).getTable();
- this.env = new Object();
-
- this.createTableSpace = function createTableSpace( catalogId ){
- NOF.Contract.Assert(NOF_DataObjects_Ecomm_TableSpaces["ts_" + catalogId] == null, "createTableSpace needs to be created only once");
- var obj = new NOF_DataObjects_Ecomm_TableSpace();
-
- if (this.env.CatalogName == null || this.env.CatalogName.length <= 0){
- var resultSet = this.CatalogsTable.selectById(catalogId);
- this.env.CatalogName = resultSet[0][NOF.DO.ecomm.CatalogsTable.COL_NAME].value;
- }
-
- obj.ProductsTable = obj.ProductsTable.getTable( this.env.CatalogName, catalogId );
-
- obj.RelatedProductsTable= obj.RelatedProductsTable.getTable( catalogId );
- obj.OptionsTable = obj.OptionsTable.getTable( catalogId );
- obj.OptionGroupsTable = obj.OptionGroupsTable.getTable( catalogId );
- obj.ProductOptionsTable = obj.ProductOptionsTable.getTable( catalogId );
- obj.ShippingTable = obj.ShippingTable.getTable( catalogId );
- obj.TaxesTable = obj.TaxesTable.getTable( catalogId );
- obj.ManufacturersTable = obj.ManufacturersTable.getTable( catalogId );
-
- NOF_DataObjects_Ecomm_TableSpaces["ts_" + catalogId] = obj;
- return obj;
- }
-
- this.getTableSpace = function getTableSpace( catalogId ){
- var tsId = "ts_" + catalogId;
-
- //if not loaded yet. load all tables
- if (NOF_DataObjects_Ecomm_TableSpaces[tsId] == null){
- NOF_DataObjects_Ecomm_TableSpaces[tsId] = this.createTableSpace(catalogId);
- }
-
- return NOF_DataObjects_Ecomm_TableSpaces[tsId];
- }
-
- this.getType = function getType( catalogId ){return this.CatalogsTable.TableSpaceBaseId + catalogId;};
-
- this.release = function release(){
- var arr = NOF_DataObjects_Ecomm_TableSpaces;
- for ( var item in arr)
- if ( typeof( arr[item] ) == 'object' && arr[item] != null)
- {
- //NOF.SysOut.info("releasing: ts" + item);
- arr[item].release();
- arr[item] = null;
- }
-
- arr = null;
- NOF_DataObjects_Ecomm_TableSpaces = null;
- };
- }
-
- var NOF_DataObjects_Ecomm_TableSpaces = new Array();
-
- function NOF_DataObjects_Ecomm_TableSpace(){
- this.ManufacturersTable = new NOF_DataObjects_ManufacturersTable;
- this.OptionGroupsTable = new NOF_DataObjects_OptionGroupsTable;
- this.OptionsTable = new NOF_DataObjects_OptionsTable;
- this.ProductOptionsTable = new NOF_DataObjects_ProductOptionsTable;
- this.ProductsTable = new NOF_DataObjects_ProductsTable;
- this.RelatedProductsTable = new NOF_DataObjects_RelatedProductsTable;
- this.ShippingTable = new NOF_DataObjects_ShippingTable;
- this.TaxesTable = new NOF_DataObjects_TaxesTable;
-
- this.release = function release(){
- if ( this.ProductsTable != null)
- this.ProductsTable.clearCache();
-
- this.TaxesTable = null;
- this.OptionGroupsTable = null;
- this.OptionsTable = null;
- this.ProductOptionsTable = null;
- this.ProductsTable = null;
- this.RelatedProductsTable = null;
- this.ShippingTable = null;
- };
- }
-
- NOF.DO.ecomm = new NOF_DataObjects_Ecomm;
-